/*************************************************************/
/*  Headers for a test of a new elasticity tensor in MOOSE   */
/*                  Status: not working                      */
/*                                                           */
/* Copyright (C) 2017, 2018  eDgar                           */
/*                                                           */
/* This program is free software: you can redistribute it    */
/* and/or modify it under the terms of the GNU General       */
/* Public License as published by the Free Software          */
/* Foundation, either version 3 of the License, or (at your  */
/* option) any later version.                                */
/*                                                           */
/* This program is distributed in the hope that it will be   */
/* useful, but WITHOUT ANY WARRANTY; without even the        */
/* implied warranty of MERCHANTABILITY or FITNESS FOR A      */
/* PARTICULAR PURPOSE.  See the GNU General Public License   */
/* for more details.                                         */
/*                                                           */
/* You should have received a copy of the GNU General Public */
/* License along with this program.  If not, see             */
/* <http://www.gnu.org/licenses/>.                           */
/*************************************************************/

// Lines like this (starting with //) are extra documentation

// This line is a conditional to make sure that the function
// is not declared twice (it ends with #endif below;
// everything in-between is within the conditional if it's
// true)
#ifndef SPIDER_H
// After making sure that the function hasn't been
// previously defined, we state that we are now going to
// define it
#define SPIDER_H

// We are going to use functions to define the elasticity tensor
// (a material needs an elasticity, strain and stress tensors),
// so we load (include, import) it at compilation time.
// This class provides, among others, _elasticity_tensor (a
// RankFourTensor MaterialProperty--Andrew Wilkins)
#include "ComputeElasticityTensorBase.h"
#include "RankTwoTensor.h"

// State what we are creating so that the App is found when
// doing the registration
class spider;

// ... and declare a (MOOSE) template for it
template <>
InputParameters
validParams<spider>();

/**
 * spider defines an elasticity tensor for the
 * St. Venant-Kirchhoff material. It is meant as a guide on
 * the implementation of (elasticity tensors of) new materials.
 */

// State what we are creating.
// We inherit from ComputeElasticityTensorBase, which
// "declares a RankFourTensor MaterialProperty called
// _elasticity_tensor that you need to populate with values
// in your computeQpElasticityTensor method"
// (andrew.wilkins)
class spider : public ComputeElasticityTensorBase
{
public:
  spider(const InputParameters & parameters);

protected:
  // - Qp refers to quadrature points
  //   - This function "Assign{s an} elasticity tensor at a given
  //     given quad point", [see ComputeElasticityTensor.C,
  //     2017-11-01]
  // - `override' means to make sure that you inherit the right
  //   thing (something that exists)
  virtual void computeQpElasticityTensor() override;

  // // Something that belongs to your object goes with _,
  // // but the program will run without it.
  // // We can declare a constant, for instance
  // const Real & _some_constant;

  // Following the style in,
  // [[moose/modules/tensor_mechanics/include/materials/ComputeIsotropicElasticityTensor.h]]
  // create Booleans which will be used to test if the Lamé
  // constants were defined in the .i (input) file
  // They become constants and pointers when the constructor
  // is defined (see spider.C):
  // (const InputParameters & parameters)
  bool _lambda_set;
  bool _mu_set;

  // These are just material properties which don't change
  // (which declaration is better?)
  /* Lamé constant \lambda and \mu (\lambda > 0, \mu > 0) */
  // const MaterialProperty<Real> & _mu;
  // const Real & _mu;
  const Real _lambda;
  const Real _mu;

  // We state that this class has a fourth order tensor
  // called _Cijkl (we could have used another name; not
  // even the indices are required)
  RankFourTensor _Cijkl;
};

// This indicates that the conditional finished, and a tag
// is next to it to identify which "if" it closes (there
// could be nested conditionals, and they become difficult
// to track).
#endif // SPIDER_H
